<template>
  <el-header style="color: darkmagenta ;font-size: large"><strong>修改hr信息</strong></el-header>
  <el-form :model="userForm" status-icon  ref="ruleForm" label-width="100px" class="demo-ruleForm">
    <el-form-item label="Name" prop="username">
      <el-input type="text" v-model="userForm.username" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="不锁定" prop="accountNonLocked">
      <el-radio-group v-model="userForm.accountNonLocked" >
        <el-radio label="true"></el-radio>
        <el-radio label="false"></el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="角色" prop="name">
      <el-radio-group v-model="userForm.roles[0].name">
        <el-radio label="ROLE_admin"></el-radio>
        <el-radio  label="ROLE_user"></el-radio>
      </el-radio-group>
      <el-radio-group v-model="userForm.roles[0].nameZh">
        <el-radio label="管理员"></el-radio>
        <el-radio  label="普通用户"></el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submitForm">提交</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name:'putUser',
  data() {
    return {
      userForm: {
        username: '',
        accountNonLocked: 'true',
        roles:[
          {
            name:'',
            nameZh:'',
          }
        ]
      },
    };
  },
  props:['id'],

  methods: {
    submitForm() {
      console.log(this.id);
      this.$http.put("http://localhost:8989/users/"+this.id,this.userForm).then(res=>{
        console.log(res.data);
      })
    },
  }
}
</script>

<style scoped>

</style>